﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="sys_t_roleform.aspx.cs" Inherits="RTGS.Web.form.usermanagement.sys_t_roleform" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Role Form</title>
    <link href="<%= ResolveClientUrl("~/css/validationEngine.jquery.css") %>" rel="stylesheet"
        type="text/css" />
    <script src="<%= ResolveClientUrl("~/script/helper.js") %>" type="text/javascript"></script>
    <script src="<%= ResolveClientUrl("~/script/jquery.validationEngine.js") %>" type="text/javascript"></script>
    <script src="<%= ResolveClientUrl("~/script/autoNumeric-1.7.5.js") %>" type="text/javascript"></script>
    <script src="<%= ResolveClientUrl("~/script/languages/jquery.validationEngine-en.js") %>"
        type="text/javascript"></script>
    <script type="text/javascript">

        $(document).ready(function () {

            // binds form submission and fields to the validation engine
            jQuery("#form1").validationEngine();

            //            jQuery("#form1").submit();
            if ($("#form1").validationEngine('validate')) { }
            else jQuery("#form1").submit();

            $("#save").click(function () {

                if ($("#form1").validationEngine('validate')) {
                    var handlerUrl = '<%= ResolveClientUrl("~/ajaxhandler/usermanagement/sys_t_role.ashx") %>';
                    var role_name = $('#txtDesc').val();
                    var id = $('#<%= hfID.ClientID %>').val();
                    var param = '&role_name=' + role_name;

                    if (id == 0)
                        CallAjax(handlerUrl, "?method=insert&" + param);
                    else
                        CallAjax(handlerUrl, "?method=update&" + param + "&id=" + id);

                    parent.$('#dialog').dialog("close");
                    setTimeout("parent.$('#table').trigger('reloadGrid');", 3000);
                }

                return false;
            });
        });
    
    </script>
    <script type="text/javascript">

        function ClearText() {

            $('#txtDesc').val('');

        }

        $('#close').click(function () {
            parent.$('#dialog').dialog("close");
        });

    </script>
</head>
<body onload="ClearText();">
    <form id="form1" runat="server">
    <table border="0">
        <tr>
            <td style="width: 50">
                Role
            </td>
            <td>
                :
            </td>
            <td>
                <asp:TextBox ID="txtDesc" runat="server" CssClass="validate[required]" Width="300"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td colspan="2">
                &nbsp;
            </td>
            <td>
                <div style="text-align: right; padding-top: 10px;">
                    <a href="#" id="save" class="dialog_link ui-state-default ui-corner-all" alt="Save">
                        <span class="ui-icon ui-icon-disk"></span>Save</a> <a href="#" id="close" class="dialog_link ui-state-default ui-corner-all"
                            alt="Close" onclick="parent.$('#dialog').dialog('close');"><span class="ui-icon ui-icon-close">
                            </span>Close</a>
                </div>
            </td>
        </tr>
        <tr>
            <td colspan="2">
                &nbsp;
            </td>
            <td>
                <asp:HiddenField ID="hfID" runat="server" />
            </td>
        </tr>
    </table>
    </form>
</body>
</html>
